package com.updateUser.mapper;

import com.updateUser.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2021-09-06
 */
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from user where is_del = 0 ")
    List<User> getAllUser();

    @Update("update user set username = #{username} where id = #{id}")
    Integer updateUserById(@Param("id") Long id,@Param("username") String username);

    @Insert("insert into user values(#{id},#{username},#{password},#{head_img_url},#{invitation_code},#{gender},#{address},#{enabled},#{is_admin},#{is_partner},#{site_id},#{is_del})")
    Integer addUser(@Param("id") Long id,@Param("username") String username,@Param("password") String password,@Param("head_img_url") String head_img_url,@Param("invitation_code") String invitation_code,@Param("gender") Integer gender,
                    @Param("address") String address,@Param("enabled") Integer enabled,@Param("is_admin") Integer is_admin,@Param("is_partner") Boolean is_partner,@Param("site_id") Integer site_id,@Param("is_del") Integer is_del);

    @Update("update user set is_del = 1 where id = #{id}")
    Integer delUser(@Param("id") Long id);

}
